<? $this->headTitle('Categories'); ?>
<? $this->placeholder('title')->set('Categories'); ?>

<p>
    <a href="<?php echo $this->url(array('controller'=>'categories', 'action'=>'add')); ?>">Add New Category</a>
</p>

<table class="t1">
    <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Description</th>
        <th>Level</th>
        <th>Parent ID (Name)</th>
        <th>&nbsp;</th>
    </tr>
    <?php foreach($this->categories as $category): ?>
    <tr>
        <td><?php echo $this->escape($category->id); ?></td>
        <td><?php echo str_repeat('--', $category->level).$this->escape($category->name); ?></td>
        <td><?php echo $this->escape($category->description); ?></td>
        <td><?php echo $this->escape($category->level); ?></td>
        <td><?php echo $category->getNode()->isRoot() ? '' : $this->escape($category->getNode()->getParent()->id . ' (' . $category->getNode()->getParent()->name . ')') ?></td>
        <td>
            <a href="<?php echo $this->url(array('controller'=>'categories', 'action'=>'edit', 'id'=>$category->id)); ?>">Edit</a>
            <a href="<?php echo $this->url(array('controller'=>'categories', 'action'=>'delete', 'id'=>$category->id)); ?>">Delete</a>
        </td>
    </tr>
    <?php endforeach; ?>
</table>